//
//  WordManager.m
//  LineByLine
//
//  Created by 병철 김 on 11. 10. 25..
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#import "WordManager.h"
#import "WordSplitter.h"


@interface WordManager (Private) 
+ (WordSplitter*) getWordSplitter:(LanguageType) languageType;
@end

@implementation WordManager

+ (WordSplitter*) newWordSplitter:(LanguageType) languageType {
    WordSplitter *wordSplitter;
    
    switch (languageType) {
        case kLanguageEN : {
            wordSplitter = [[EnglishWordSplitter alloc] init];
            break;
        }
        default : {
            wordSplitter = [[SpaceWordSplitter alloc] init];
            break;
        }
    }
    return wordSplitter;
}

+ (NSArray*) splitWords:(NSString*) sentence language:(LanguageType) languageType {
    WordSplitter *wordSplitter = [self newWordSplitter:languageType];
    NSArray *words = [wordSplitter splitWords:sentence];
    [wordSplitter release];
    return words;
}

@end
